<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>振兴市政水电费商用收费管理平台</title>
<link rel='stylesheet' type='text/css' href='__PUBLIC__/Css/style.css'>
<load href='__PUBLIC__/Js/Base.js'/>
<load href='__PUBLIC__/Js/Jquery/jquery.js'/>
<style>
 body{font-family:tahoma; background-color:#fff;font-size:14px; color:#525252;}

</style>
<script language="javascript">
 var countn =new Array();
	$(function() { 

		initPnum();
		$("#selall").click( 
			function(){ 
	
				if(this.checked){ 
					$("input[name='selesid[]']").each(function(){this.checked=true;}); 

					$("#r_pay",window.parent.document).html(accAdd(Number($("#r_pay",window.parent.document).html()),countn[4]));
					$("#p_list",window.parent.document).val(countn[5]);
				}else{ 
					$("input[name='selesid[]']").each(function(){this.checked=false;}); 
					$("#r_pay",window.parent.document).html(accSubtr(Number($("#r_pay",window.parent.document).html()),countn[4]));
				$("#p_list",window.parent.document).val("0");	
				} 
			});

}); 


	function selectID(i){
		if($("#selesid_"+i).is(":checked")){ 
		
					$("#selesid_"+i).checked=true; 
					if(mycheckbox()){
						$("#selall").attr("checked",true);
					}
					$("#r_pay",window.parent.document).html(accAdd(Number($("#r_pay",window.parent.document).html()),Number($("#p_count_"+i).html())));
					$("#invo_num",window.parent.document).html(accAdd(Number($("#invo_num",window.parent.document).html()),Number($("#p_count_"+i).html())));
				}else{ 
					$("#selesid_"+i).checked=false; 
					$("#selall").removeAttr("checked");
					$("#r_pay",window.parent.document).html(accSubtr(Number($("#r_pay",window.parent.document).html()),Number($("#p_count_"+i).html())));
					$("#invo_num",window.parent.document).html(accSubtr(Number($("#invo_num",window.parent.document).html()),Number($("#p_count_"+i).html())));
	
	}
	var str="";
	$("input[name='selesid[]']:checkbox").each(function () { 
			if ($(this).attr("checked")) { 
				str=str+","+$(this).val();

			} 
	})
	
	$("#ap_list").val(str);
	}
	
	function mycheckbox() { 
		var falg = 0; 
		$("input[name='selesid[]']:checkbox").each(function () { 
			if ($(this).attr("checked")) { 
				falg =1; 
				return false; 
			} 
		}) 
		if (falg > 0) 
		return true; 
		else 
		return false; 
}



	
	function initPnum(){
       
		var wnum=0;
		var ennum=0;
		var wwnum=0;
		var p_count=0;
		var p_list="";
		var countNum =document.getElementById('tblist').getElementsByTagName('tr').length-1;
		 for (i=1;i<=countNum;i++)
		{
			wnum=accAdd(wnum,Number($("#wnum_"+i).html()));
			ennum=accAdd(ennum,Number($("#enum_"+i).html()));
			wwnum=accAdd(wwnum,Number($("#wwnum_"+i).html()));
			p_count=accAdd(p_count,Number($("#p_count_"+i).html()));
			p_list=p_list+","+$("#selesid_"+i).val();
		}
		countn[0]= wnum;
		countn[1]= ennum;
		countn[3]= wwnum;
		countn[4]= p_count;
		countn[5]=p_list;
        $("#r_pay",window.parent.document).html(accAdd(countn[4],Number($("#r_pay",window.parent.document).html())));  
		$("#invo_num",window.parent.document).html(countn[4]);
		$("#ap_list").val(countn[5]);
		 
   }
   		//全选
		
</script>
</head>
<body>
<!-- 版权信息区域 -->
<div>
<table id="tblist" width="99%" border="0" cellspacing="0" cellpadding="8" style="font-size:14px;color:#525252; margin:6px;; padding:6px;">
  <tr style="background-color:#f6f6f6;height:35px;">
    <td width="8%" style="border-left:#3399ff 6px solid;padding-left:4px;"><input type="checkbox" name="selall" id="selall" checked="checked"> 选择</td>
    <td width="12%">单号</td>
    <td width="10%">水量</td>
    <td width="10%">水费</td>
    <td width="10%">电量</td>
    <td width="10%">电费</td>
    <td width="10%">污水处理费</td>
    <td width="15%">合计
      <input type="hidden" name="ap_list" id="ap_list" value=""></td>
    <td width="15%">月份</td>
  </tr>
  <volist name="list" id="vo">
  <tr style="height:35px;border-bottom:#f6f6f6 1px solid;">
    <td style="padding-left:10px;border-bottom:#ececec 1px solid;"><input type="checkbox" name="selesid[]" id="selesid_{$i}" value="{$vo.id}" checked="checked" onclick="selectID({$i});"></td>
    <td  style="border-bottom:#ececec 1px solid;">{$vo.resid}</td>
    <td  style="border-bottom:#ececec 1px solid;" id="awnum_{$i}">{$vo.awnum}</td>
    <td  style="border-bottom:#ececec 1px solid;" id="wnum_{$i}">{$vo.wnum1}</td>
    <td style="border-bottom:#ececec 1px solid;" id="aenum_{$i}">{$vo.aenum}</td>
    <td style="border-bottom:#ececec 1px solid;" id="enum_{$i}">{$vo.enum1}</td>
    <td style="border-bottom:#ececec 1px solid;" id="wwnum_{$i}">{$vo.wwnum}</td>
    <td style="border-bottom:#ececec 1px solid;" id="p_count_{$i}" >{$vo['wnum1']+$vo['enum1']+$vo['wwnum']}</td>
    <td style="border-bottom:#ececec 1px solid;">{$vo.meterMon}</td>
  </tr>
  </volist>
 
</table>
<script language="javascript">

</script>
</div>
</body>
</html>